﻿#region Creditos

/* Autor: Edilberto Sánchez Forero	*/
/* Email: esanchezfo@gmail.com		*/
/* Licencia: LGPL, Software Libre	*/
/* País: Colombia, Bogotá			*/

#endregion

#region Librerias

//using ESF.Bulk;

using Microsoft.Office.Interop.Excel;
using ESF.General.Bulk;

#endregion


namespace ESF.MSExcel
{
	public class XlsReadCellTask : ITask
	{
		#region Miembros
		
		private Range _UsedRange;
		
		private int _RowIndex;
		
		private int _ColIndex;
		
		private XlsCell [,] _MtxCells;
		
		#endregion
		
		
		#region Constructor
		
		public XlsReadCellTask (ref XlsCell [,] pMtxCells, ref Range pUsedRange, int pRowIndex, int pColIndex)
		{
			_UsedRange = pUsedRange;
			
			_MtxCells = pMtxCells;
			
			_RowIndex = pRowIndex;
			_ColIndex = pColIndex;
		}
		
		#endregion
	
	
		#region ITask Members

		public void Do ()
		{
			_MtxCells [_RowIndex,_ColIndex] = XlsReader.GetCell ((Range) _UsedRange.Cells [_RowIndex + 1, _ColIndex + 1]);
		}

		public void Confirm()
		{		
		}

		public void Stop()
		{
		}

		#endregion
		
		
		#region Funciones

		public override string ToString()
		{
			return string.Format ("Reading {0}, {1}", _RowIndex, _ColIndex);
		}
		
		#endregion
	}
}
